package com.doit.demo_Annotation;

import java.lang.annotation.Annotation;

@MyAnnotation(name="段哥",names={"你爹","是我"})
public class test {
    public static void main(String[] args) {
        /*
         1.获取类上的注解
		 2.获取这个类的字节码文件对象
		 3.判断这个类上是否有注解
		 4.获取对应的注解
         */
        Class c = test.class;
        boolean b = c.isAnnotationPresent(MyAnnotation.class);
        if (b){
            MyAnnotation bb = (MyAnnotation)c.getAnnotation(MyAnnotation.class);
            System.out.println(bb.name());
            System.out.println(bb.names());
        }
    }
}
